package com.lago.service;

import com.lago.mapper.ArticleRepository;
import com.lago.pojo.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;


@Service
public class ArticleService {
    @Autowired
    private ArticleRepository articleRepository;

    public Page<Article> findForPage(int pageNum, int pageSize) {
        Pageable pageable = PageRequest.of(pageNum, pageSize);
        Page<Article> page = articleRepository.findAll(pageable);
        return page;
    }
}
